
package system.base;

import framework.core.*;
import system.base.MonthStorageSearchEvent;

/*
    Author    :Jackey
    CreateTime:2008-02-19 14:11:28
*/
public class HistoryGWPublicMenuSrv extends IHandler
{   
    public HistoryGWPublicMenuSrv() 
    {
        super();
    }
    
    public void doAction(DBConnection con,SrvContext context,ILoginContext loginContext) throws Exception
    {
        String action_code = context.getActionCode();
        String pathReport = "/system/history/";
        
        //报表菜单 start
        //到压库产品进销存报表
        if(action_code.equalsIgnoreCase("listReportYKProductHis"))
        {
            context.setNextUrl(pathReport + "ReportYKProduct.jsp");
            return;
        }
        //到领用报表
        if(action_code.equalsIgnoreCase("listReportCustomerHis"))
        {
            context.setNextUrl(pathReport + "ReportCustomer.jsp");
            return;
        }
        //到压库产品进销存资金汇总月报
        if(action_code.equalsIgnoreCase("listReportYKProductMonthHis"))
        {
            context.setNextUrl(pathReport + "ReportYKProductMonth.jsp");
            return;
        }  
        //压库产品分类月进出明细
        if(action_code.equalsIgnoreCase("listReportYKProductMonthListHis"))
        {
            context.setNextUrl(pathReport + "ReportYKProductMonthList.jsp");
            return;
        }   
        //到压库产品应付款月报
        if(action_code.equalsIgnoreCase("listReportYKMoneyMonthHis"))
        {
            context.setNextUrl(pathReport + "ReportYKMoneyMonth.jsp");
            return;
        }        
        //到买断产品资金进出累计汇总
        if(action_code.equalsIgnoreCase("listReportMDMoneyInoutHis"))
        {
            context.setNextUrl(pathReport + "ReportMDMoneyInout.jsp");
            return;
        }
      //到合并库收料清单
        if(action_code.equalsIgnoreCase("listReportCustomerInListHis"))
        {
            context.setNextUrl(pathReport + "ReportCustomerInList.jsp");
            return;
        }
        //到买断产品资金进出累计汇总
        if(action_code.equalsIgnoreCase("listReportMDWCMoneyInoutHis"))
        {
            context.setNextUrl(pathReport + "ReportMDWCMoneyInout.jsp");
            return;
        }
        /** 新报表查询逻辑添加的页面***************/
        //1------9
        if(action_code.equalsIgnoreCase("listReportYKProductNewHis"))
        {
            context.setNextUrl(pathReport + "ReportYKProductNew.jsp");
            return;
        }
        //3------10
        if(action_code.equalsIgnoreCase("listReportYKProductMonthNewHis"))
        {
            context.setNextUrl(pathReport + "ReportYKProductMonthNew.jsp");
            return;
        }
        //5------11
        if(action_code.equalsIgnoreCase("listReportMDMoneyInoutNewHis"))
        {
            context.setNextUrl(pathReport + "ReportMDMoneyInoutNew.jsp");
            return;
        }
        //7-----12
        if(action_code.equalsIgnoreCase("listReportYKProductMonthListNewHis"))
        {
            context.setNextUrl(pathReport + "ReportYKProductMonthListNew.jsp");
            return;
        }
        //8-----13
        if(action_code.equalsIgnoreCase("listReportMDWCMoneyInoutNewHis"))
        {
            context.setNextUrl(pathReport + "ReportMDWCMoneyInoutNew.jsp");
            return;
        }
        //14
        if(action_code.equalsIgnoreCase("listReportAllWarehouseMoneyMonthSumHis"))
        {
            context.setNextUrl(pathReport + "ReportAllWarehouseMoneyMonthSum.jsp");
            return;
        }
        //到买断进销存页面
        if(action_code.equalsIgnoreCase("listReportMDProductHis")){
            context.setNextUrl(pathReport+"ReportMDProduct.jsp");
            return ;
        }
       /*******************月结******************/

        //到产品进销存（月结）页面
        if(action_code.equalsIgnoreCase("listReportProductMSHis")){
            search(con, context);
            context.setNextUrl(pathReport+"ReportProductMS.jsp");
            return ;
        }
        //到领用报表(月结)
        if(action_code.equalsIgnoreCase("listReportCustomerMSHis"))
        {
            context.setNextUrl(pathReport + "ReportCustomerMS.jsp");
            return;
        }
        //产品进、销、存资金汇总报表(产品分类)(月结)
        if(action_code.equalsIgnoreCase("listReportMoneyInoutProductCategoryMSHis"))
        {
            search(con, context);
            context.setNextUrl(pathReport + "ReportMoneyInoutProductCategoryMS.jsp");
            return;
        }      
        //产品进、销、存资金汇总报表（仓库分类）(月结)
        if(action_code.equalsIgnoreCase("listReportMoneyInoutWarehouseCategoryMSHis"))
        {
            search(con, context);
            context.setNextUrl(pathReport + "ReportMoneyInoutWarehouseCategoryMS.jsp");
            return;
        }      
   
        //到压库产品应付款月报(月结)
        if(action_code.equalsIgnoreCase("listReportYKMoneyMonthMSHis"))
        {
            context.setNextUrl(pathReport + "ReportYKMoneyMonthMS.jsp");
            return;
        }   
           //到空调报表页面
        if(action_code.equalsIgnoreCase("listReportAirProductHis")){
            context.setNextUrl(pathReport+"ReportAirProduct.jsp");
            return ;
        }
        
        //到产品进销存供应商分类报表页面
        if(action_code.equalsIgnoreCase("listReportProductHis")){
            context.setNextUrl(pathReport+"ReportProduct.jsp");
            return ;
        }
        //供应商应付报表
       if(action_code.equalsIgnoreCase("listProviderProductHis")){
            context.setNextUrl(pathReport+"ReportProvider.jsp");
            return ;
        }
       
       //供应商结算分类明细报表
       if(action_code.equalsIgnoreCase("listProviderProductTypeHis")){
            context.setNextUrl(pathReport+"ReportProviderProductType.jsp");
            return ;
        }
       
       //供应商结算分类总汇报表
       if(action_code.equalsIgnoreCase("listProviderProductTypeAllHis")){
            context.setNextUrl(pathReport+"ReportProviderProductTypAll.jsp");
            return ;
        }

        
        Logger.throwException("GWPublicMenuSrv","unknown action_code="+action_code);
    }   
    private void search(DBConnection con,SrvContext context)throws Exception{
        MonthStorageSearchEvent event = (MonthStorageSearchEvent)SearchEvent.fromForm(context,MonthStorageSearchEvent.class);
        String warehouse_code;
        try {
            warehouse_code = context.getString("warehouseCode").trim();
        } catch (RuntimeException e) {
            warehouse_code ="";
        }
        if(warehouse_code!=null&&!warehouse_code.equals("")){
            event.setWarehouseCodes(new String []{warehouse_code});
        }
        context.setSessionValue("MonthStorageSearchEvent",event);;
    }

}